/*
 * Copyright 2024 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.pajamas.protocol;

import java.io.File;
import java.io.IOException;

/**
 * @author william
 * @since 2024/1/1
 */

public interface Serializer extends OverrideLess {
    /**
     * text -> object
     *
     * @param text text
     * @param clz  clz
     * @return T
     * @author william
     * @since 2024/1/21
     */
    default <T> T objectify(String text, Class<T> clz) {
        this.unsupported();
        return null;
    }

    /**
     * file -> object
     *
     * @param file file
     * @param clz  clz
     * @return T
     * @author william
     * @since 2024/1/21
     */
    default <T> T objectify(File file, Class<T> clz) throws IOException {
        this.unsupported();
        return null;
    }

    /**
     * bytes -> object
     *
     * @param bytes bytes
     * @param clz   clz
     * @return T
     * @author william
     * @since 2024/5/26
     */
    default <T> T objectify(byte[] bytes, Class<T> clz) throws IOException {
        this.unsupported();
        return null;
    }

    /**
     * object -> text
     *
     * @param object object
     * @return java.lang.String
     * @author william
     * @since 2024/1/21
     */
    default <T> String stringify(T object) {
        this.unsupported();
        return null;
    }

    /**
     * file -> text
     *
     * @param file file
     * @return java.lang.String
     * @author william
     * @since 2024/1/21
     */
    default String stringify(File file) throws IOException {
        this.unsupported();
        return null;
    }

    /**
     * bytes -> text
     *
     * @param bytes bytes
     * @return T
     * @author william
     * @since 2024/5/26
     */
    default String stringify(byte[] bytes) throws IOException {
        this.unsupported();
        return null;
    }

    /**
     * object -> file
     *
     * @param object object
     * @param file   file
     * @author william
     * @since 2024/1/21
     */
    default <T> void placeToFile(T object, File file) throws IOException {
        this.unsupported();
    }

    /**
     * text -> file
     *
     * @param text text
     * @param file file
     * @author william
     * @since 2024/1/21
     */
    default void placeToFile(String text, File file) throws IOException {
        this.unsupported();
    }

    /**
     * bytes -> file
     *
     * @param bytes bytes
     * @param file  file
     * @author william
     * @since 2024/5/26
     */
    default void placeToFile(byte[] bytes, File file) throws IOException {
        this.unsupported();
    }

    /**
     * object -> bytes
     *
     * @param Object Object
     * @return byte[]
     * @author william
     * @since 2024/5/26
     */
    default <T> byte[] toBytes(T Object) throws IOException {
        this.unsupported();
        return null;
    }

    /**
     * text -> bytes
     *
     * @param text text
     * @return byte[]
     * @author william
     * @since 2024/5/26
     */
    default byte[] toBytes(String text) throws IOException {
        this.unsupported();
        return null;
    }

    /**
     * file -> bytes
     *
     * @param file file
     * @return byte[]
     * @author william
     * @since 2024/5/26
     */
    default byte[] toBytes(File file) throws IOException {
        this.unsupported();
        return null;
    }
}
